﻿using System;
using System.Linq;
using System.IO;
using System.IO.IsolatedStorage;
using System.Collections.Generic;
using Microsoft.LightSwitch;
using Microsoft.LightSwitch.Framework.Client;
using Microsoft.LightSwitch.Presentation;
using Microsoft.LightSwitch.Presentation.Extensions;
using System.Collections.Specialized;

namespace LightSwitchApplication
{
    public partial class ProductDetail
    {
        partial void Product_Loaded(bool succeeded)
        {
            // Write your code here.
            this.SetDisplayNameFromEntity(this.Product);
        }

        partial void Product_Changed()
        {
            // Write your code here.
            this.SetDisplayNameFromEntity(this.Product);
        }

        partial void ProductDetail_Saved()
        {
            // Write your code here.
            this.SetDisplayNameFromEntity(this.Product);
        }

        partial void ProductDetail_Activated()
        {
            this.DisplayName = this.Product.ProductName + " (товар)";
        }

        partial void ShowAuditHistory_Execute()
        {
            this.Application.ShowAuditLogHistory("Товары", this.Product.Id);
        }

        partial void ProductDetail_InitializeDataWorkspace(List<IDataService> saveChangesTo)
        {
            this.FindControl("Save").IsEnabled = this.Application.User.HasPermission(Permissions.CanEditProduct);
        }

    }
}